{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/addons/builder/css/common.css" media="all">
<input type="hidden" id="admin_map" value="{:env('app_map.admin_map')}"/>
<input type="hidden" id="uploads_url" value="{:url('uploads/uploadImage')}"/>
<input type="hidden" id="uploadEditorVideo" value="{:url('uploads/uploadEditorVideo')}"/>
<link rel="stylesheet" href="/static/index/css/merchant.css?v=<?php echo time();?>">

<link rel="stylesheet" href="/static/admin/addons/gallery/css/gallery.css" media="all">
<link rel="stylesheet" href="https://static.resource.zhiju002.com/css/wangEditor.css">

<link rel="stylesheet" href="/static/admin/addons/builder/css/base.css" media="all" >

<body>
    <div class="header">
        <i class="layui-icon layui-icon-left goBack"></i>商品信息
    </div>
<form class="layui-form" id="form" action="{:url('saveProduct')}" lay-filter='form'>
    <div class="layui-fluid layui-anim layui-anim-downbit">

        <div class="layui-card">

            <div class="layui-card-body" style="padding: 15px;">

                <input type="hidden" name="id" id="id" value="{$info?$info.id:''}"/>
                <input type="hidden" name="shop_type" value="2"/>
                <input type="hidden" name="merchant_id" id="merchant_id" value="{$merchant->id}"/>
                <div class="layui-tab layui-tab-brief" lay-filter="brief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">商品信息</li>
                        <li>商品详情</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <label class="layui-form-label">商品名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" placeholder="请填写商品名称" class="layui-input"
                                           value="{$info?$info.title:''}"/>
                                </div>
                            </div>
                            {if isset($info) && $info.is_audit == 2}
                                    <input type="hidden" name="merchant_bl" placeholder="请填写商家收入比例" class="layui-input"
                                           value="{$info?round(($info.merchant_bl*100),2):''}"/>
                                    <input type="hidden" name="tp_1" placeholder="请填写直推消费奖" class="layui-input"
                                           value="{$info?round(($info.tp_1*100),2):''}"/>
                               
                                    <input type="hidden" name="tp_2" placeholder="请填写直推商家奖" class="layui-input"
                                           value="{$info?round(($info.tp_2*100),2):''}"/>
                                
                                    <input type="hidden" name="service_1" placeholder="请填写一星服务费" class="layui-input"
                                           value="{$info?round(($info.service_1*100),2):''}"/>
                                
                                    <input type="hidden" name="service_2" placeholder="请填写二星服务费" class="layui-input"
                                           value="{$info?round(($info.service_2*100),2):''}"/>
                               
                                    <input type="hidden" name="service_3" placeholder="请填写三星服务费" class="layui-input"
                                           value="{$info?round(($info.service_3*100),2):''}"/>
                            {else}
                            
                            <div class="layui-form-item">
                                <label class="layui-form-label">商家收入比例</label>
                                <div class="layui-input-inline fl">
                                    <input type="text" name="merchant_bl" placeholder="请填写商家收入比例" class="layui-input"
                                           value="{$info?round(($info.merchant_bl*100),2):''}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">%</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">直推消费奖</label>
                                <div class="layui-input-inline fl">
                                    <input type="text" name="tp_1" placeholder="请填写直推消费奖" class="layui-input"
                                           value="{$info?round(($info.tp_1*100),2):''}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">%</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">直推商家奖</label>
                                <div class="layui-input-inline fl">
                                    <input type="text" name="tp_2" placeholder="请填写直推商家奖" class="layui-input"
                                           value="{$info?round(($info.tp_2*100),2):''}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">%</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">一星服务费</label>
                                <div class="layui-input-inline fl">
                                    <input type="text" name="service_1" placeholder="请填写一星服务费" class="layui-input"
                                           value="{$info?round(($info.service_1*100),2):''}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">%</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">二星服务费</label>
                                <div class="layui-input-inline fl">
                                    <input type="text" name="service_2" placeholder="请填写二星服务费" class="layui-input"
                                           value="{$info?round(($info.service_2*100),2):''}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">%</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">三星服务费</label>
                                <div class="layui-input-inline fl">
                                    <input type="text" name="service_3" placeholder="请填写三星服务费" class="layui-input"
                                           value="{$info?round(($info.service_3*100),2):''}"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">%</div>
                            </div>
                            {/if}
                            <!-- 引入分类  -->
                            {include file="merchant/cope/cate" /}
                            <!-- 引入分类End -->

                            <div class="layui-form-item">
                                <label class="layui-form-label">排序</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="sort" autocomplete="off"
                                           placeholder="请输入排序，越小越靠前"
                                           class="layui-input"
                                           value="{$info?$info.sort:''}">
                                </div>
                            </div>

                            <div class="layui-form-item">

                                <label class="layui-form-label">商品轮播图</label>
                                <?php 
                                $data = isset($info)?$info:[];
                                $form=["field" => "images", "value" => 10];
                                ?>
                                <div class="layui-input-block">
                                {include file="merchant/cope/img_nil" /}
                                </div>
                                <div class="layui-form-mid layui-text-em layui-text-em2">
                                    建议尺寸：800*800，默认首张图为主图，最多上传10张
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">运费</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="freight" value="{$info?$info.freight:''}"
                                               placeholder="请填写运费，默认0" autocomplete="off" class="layui-input"
                                               onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')">
                                    </div>

                                </div>
                            </div>
                            
                            <div class="layui-form-item">
                                <label class="layui-form-label">库存</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="stock" autocomplete="off"
                                           placeholder="请输入库存"
                                           class="layui-input"
                                           value="{$info?$info.stock:'99999'}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">零售价</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="price" value="{$info?$info.price:''}"
                                               placeholder="请填写零售价" autocomplete="off" class="layui-input"
                                               onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')">
                                    </div>

                                </div>
                            </div>
                            
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">金币价</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="vip_price" value="{$info?$info.vip_price:''}"
                                               placeholder="请填写金币价" autocomplete="off" class="layui-input"
                                               onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')">
                                    </div>

                                </div>
                            </div>
                        </div>

                        <div class="layui-tab-item">
                                {include file="merchant/cope/editor" /}
                           
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="width: 100%; height: 80px;"></div>
    <div class="add_foot" lay-filter="saveProduct" lay-submit>保存</div>
</form>
</body>
{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/js/jquery-ui.js"></script>
<script type="text/javascript" src="/static/admin/addons/builder/js/notify.js"></script>
<script type="text/javascript" src="/static/admin/js/wangEditor.js"></script>
<script type="text/javascript" src="/static/admin/addons/builder/js/sundry.js"></script>

<script>
    // 加载框架核心模块
    layui.extend({
        listen: "{/}/static/admin/addons/builder/define/core/listen",
        wangEditor: "{/}/static/admin/addons/builder/define/core/wangEditorIndex",
        gallery: "{/}/static/admin/addons/gallery/js/gallery",
    }).use(['listen', 'gallery', 'wangEditor'], function () {
        layui.listen.init(); //初始化各种监听事件
        layui.gallery.init(); //初始化图库
        layui.wangEditor.init(); //初始化wangEditor
    });
</script>
{include file="merchant/cope/js" /}
{include file="merchant/cope/css" /}
<style>
    .layui-tab-title  .layui-this {
        color: var(--bc) !important;
        font-size: 15px !important;
        font-weight: bold;
    }
</style>
</html>